#include <stdio.h>

void selectSort(int* array, int length)
{
    int i,j;
    int temp,max;
    for(i = 0; i < length; ++i) {
	j = i + 1;
	max = i;
	while(j < length) {
	    if(array[j] > array[max]) {
		max = j;
	    }
	    j++;
	}
	if(max != i) {
	    temp = array[i];
	    array[i] = array[max];
	    array[max] = temp;
	}
    }
}
